﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Vds2465Telegrams
{
	[TestClass]
	public class UserData_56_IdentificationNumber_Test
	{
		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test01_Equals()
		{
			UserData_56_IdentificationNumber userData = new UserData_56_IdentificationNumber("344634");

			{
				// completely different type - NOT equal
				object dummyObject = new object();
				Assert.IsFalse(userData.Equals(dummyObject));
			}

			{
				// different derived type 
				ReportType_Device reportType = new ReportType_Device(false, eReportSubType_Device.General);
				UserData userData2Compare = new UserData_02_StatusChangeReport2Confirm(0x01, 0x02, 0x03, eAddressExtension_1.Input, reportType);
				Assert.IsFalse(userData.Equals(userData2Compare));
			}

			{
				// same object - equal
				UserData_56_IdentificationNumber userData2Compare = new UserData_56_IdentificationNumber(userData.IdentificationNumber);
				Assert.IsTrue(userData.Equals(userData2Compare));
			}

			{
				// different id
				UserData_56_IdentificationNumber userData2Compare = new UserData_56_IdentificationNumber(userData.IdentificationNumber + "3");
				Assert.IsFalse(userData.Equals(userData2Compare));
			}
		}

		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test02_GetHashCode()
		{
			{
				UserData_56_IdentificationNumber userData = new UserData_56_IdentificationNumber("0");
				int hashCode = userData.GetHashCode();
			}

			{
				UserData_56_IdentificationNumber userData = new UserData_56_IdentificationNumber("123456789012");
				int hashCode = userData.GetHashCode();
			}
		}

		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test03_ToString()
		{
			{
				UserData_56_IdentificationNumber userData = new UserData_56_IdentificationNumber("3454");
				string stringResult = userData.ToString();
				Assert.IsNotNull(stringResult);
			}

			{
				UserData_56_IdentificationNumber userData = new UserData_56_IdentificationNumber("123456789012");
				string stringResult = userData.ToString();
				Assert.IsNotNull(stringResult);
			}
		}
	}
}
